/**
 * Copyright (C), 2012-2018, 联奕科技有限公司
 * FileName: MockQueue
 * Author:   石贵武
 * Date:     2018\3\8 0008 10:01
 * Description: 模拟消息队列
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zhoudongxiu.web.async;

import lombok.Data;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 〈一句话功能简述〉<br>
 * 〈模拟消息队列〉
 *
 * @author 石贵武
 * @create 2018\3\8 0008
 * @since 1.0.0
 */
@Slf4j
@Getter
@Component
public class MockQueue {

    private String placeOrder;

    private String completeOrder;


    public void setPlaceOrder (String placeOrder) throws InterruptedException {
        new Thread(() -> {
            log.info("接到下单请求,placeOrder={}", placeOrder);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            this.completeOrder = placeOrder;
            log.info("下单处理请求完毕,#######################");
        }).start();
    }

    public void setCompleteOrder(String completeOrder) {

        this.completeOrder = completeOrder;
    }
}